package org.chispa.api.falsepos;

public class StringFilter {
	
	private String filterWord;
	
	private StringFilterMode mode;
	
	public StringFilter(String word,StringFilterMode mode)
	{
		filterWord=word.replaceFirst("\"", "");
		filterWord=filterWord.substring(0,filterWord.length()-1);
		this.mode=mode;
	}
	
	public boolean check(String value)
	{
		if(mode.equals(StringFilterMode.FULL))
			return filterWord.equals(value);
		else if(mode.equals(StringFilterMode.LIKE))
			return value.contains(filterWord);
		return !value.contains(filterWord);
	}

}
